package com.sunshine.controller;

import com.sunshine.model.InformationMapper;
import com.sunshine.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

import static com.sunshine.util.Result.json;

/**
 * Created by along on 11/18/17.
 */
@RestController
@RequestMapping("/count")
public class CountController {

    @Autowired
    private InformationMapper informationMapper;

    @GetMapping
    public Map<String, Object> show() {
        Map<String, Object> result = json(Result.STATUS_CODE.SUCCESS);
        result.put("sum", informationMapper.countSum());
        result.put("end", informationMapper.countEnd());
        return result;
    }
}
